package com.leyou.auth.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
   // 创建一个 配置类 用于 方便 AliAuthServiceImpl中注入 创建OSS客户端
@Configuration
public class OSSConfig {

    @Bean
    public OSS ossClient(OSSProperties prop){
        return new OSSClientBuilder()
                //  获取 endpoint, accessId, accessKey这三个参数
                // 相当于 ： OSS client = new OSSClient(endpoint, accessId, accessKey);
                .build(prop.getEndpoint(), prop.getAccessKeyId(), prop.getAccessKeySecret());
    }
}
